﻿using System;
using LogLibrary.Entity;
using SilverPOP.Data.Process.Helpers.LoggerHelper;
using System.Configuration;
using SilverPOP.Data.Process.Entity;

namespace SilverPOP.Data.Process
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Initiating the Opration....");
           //Connection for Logger
            LogConnectionInfo.SqlConnectionString = ConfigurationManager.ConnectionStrings["LoggerDatabaseContext"].ConnectionString;
            SilverPopConnectionInfo.SqlConnectionString = ConfigurationManager.ConnectionStrings["SilverPopApiDatabaseContext"].ConnectionString;


            TaskList taskList = new TaskList();
            if (taskList.SetTaskList())
            {
                Console.WriteLine("Start Process Execution....");
                taskList.ExecuteTaskList();
                Console.WriteLine("End Process Execution....");
            }
            else
            {
                Console.WriteLine("Don't have any task right now.");
                var logInfo = new LogServiceInformation { CustomErrorMessage = "Don't have any task right now.", StackTrace = Environment.StackTrace };
                LoggerHelper.Log(logInfo, typeof(Program), LogType.WARN);
            }



            Console.WriteLine("End Opration.");
            //Console.WriteLine("Press any key to exit");
            //Console.Read();

        }
    }
}
